import 'package:flutter/material.dart';
import 'package:yp/helper.dart';

class TurntableAwardGetView extends StatelessWidget {
  TurntableAwardGetView({Key key, this.configInfo, this.data, this.getEvent})
      : super(key: key);
  final Map configInfo;
  final Map data;
  final VoidCallback getEvent;
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            margin: EdgeInsets.symmetric(horizontal: setWidth(30)),
            padding: EdgeInsets.symmetric(
                horizontal: setWidth(32), vertical: setWidth(60)),
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(setWidth(22))),
            child: Column(
              children: [
                Center(
                  child: Image.network(
                    configInfo['reward_picture_url'],
                    height: setWidth(216),
                    fit: BoxFit.cover,
                  ),
                ),
                Center(
                  child: Text.rich(TextSpan(
                      text: '恭喜您获得：',
                      style: TextStyle(
                          color: Color(0xff222222), fontSize: setWidth(30)),
                      children: [
                        TextSpan(
                            text: data['reward_name'],
                            style: TextStyle(
                                color: Color(0xffEF2F45),
                                fontWeight: FontWeight.bold,
                                fontSize: setWidth(32)))
                      ])),
                ),
                Text(
                  '兑换期限：' +
                      data['exchange_begin_dtme'] +
                      '至' +
                      data['exchange_end_dtme'] +
                      '\n请在奖品有效期内前往我的奖品领取',
                  style: TextStyle(
                      color: Color(0xff666666), fontSize: setWidth(28)),
                ),
                Container(
                  margin:
                      EdgeInsets.only(top: setWidth(30), bottom: setWidth(20)),
                  alignment: Alignment.centerLeft,
                  child: Text(
                    '奖品说明：',
                    style: TextStyle(
                        color: Color(0xff222222),
                        fontSize: setWidth(30),
                        fontWeight: FontWeight.bold),
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(bottom: setWidth(80)),
                  alignment: Alignment.centerLeft,
                  child: Text(
                    data['reward_description'],
                    style: TextStyle(
                        color: Color(0xff666666), fontSize: setWidth(28)),
                  ),
                ),
                Container(
                  width: setWidth(560),
                  height: setWidth(104),
                  decoration: BoxDecoration(
                      color: Color(0xfffa5843),
                      borderRadius: BorderRadius.circular(setWidth(52))),
                  child: TextButton(
                      onPressed: getEvent,
                      child: Text(
                        '领取奖品',
                        style: TextStyle(
                            color: Colors.white, fontSize: setWidth(40)),
                      )),
                )
              ],
            ),
          ),
        ],
      ),
    );
  }
}
